﻿// ***********************************************************************
// Assembly         : NIMServerApi
// Author           : Walter
// Created          : 11-11-2016
//
// Last Modified By : Walter
// Last Modified On : 11-11-2016
// ***********************************************************************
// <copyright file="ObjectExtension.cs" company="">
//     Copyright ©  2016
// </copyright>
// <summary></summary>
// ***********************************************************************

namespace NIMServerApi.Commons
{
    /// <summary>
    /// Class ObjectExtension.
    /// </summary>
    public static class ObjectExtension
    {
        /// <summary>
        /// To the json.
        /// </summary>
        /// <param name="obj">The object.</param>
        /// <returns>System.String.</returns>
        public static string ToJson(this object obj)
        {
            if (obj == null) return string.Empty;
            return Newtonsoft.Json.JsonConvert.SerializeObject(obj);
        }
    }
}